package org.alanlau;

import com.fasterxml.jackson.databind.ObjectMapper;
import feign.RequestInterceptor;
import org.alanlau.filter.FeignRequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

 /**
  * 自动配置
  * @author alan
  * @date  2020/9/16 19:16
  * @version 1.0
  */
@Configuration
public class FeignEnhanceAutoConfiguration
{
    @Autowired(required =  false)
    private ObjectMapper objectMapper;

    @Bean
    public RequestInterceptor requestInterceptor() {
        return new FeignRequestInterceptor(objectMapper);
    }
}
